Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Features #86

Merged
merged 32 commits into from
Oct 11, 2023
Merged

Features #86

merged 32 commits into from
Oct 11, 2023

Conversation

computablee
Copy link
Owner

Which issue are you addressing?

Closes #39

How have you addressed the issue?

There has been a significant amount of refactoring done in the inner scheduler code to make this possible. This PR adds the Wrappers.cs file, which contains several new delegates and the ForAction<T> class. The methods in Iter now defer to ForAction<T>.PerformLoop to execute a chunk. The overhead should be negligible for non-collapsed loops. For collapsed loops, new control flow exists to un-flatten the indices from the scheduler into 2D, 3D, 4D, or even higher dimensional loops. This infrastructure exists with both non-reduction and reduction loops. New methods have been implemented into the Parallel class, including ForCollapse, ForReductionCollapse, ParallelForCollapse, and ParallelForReductionCollapse, each with several overloads based on the collapse factor.

How have you tested your patch?

New tests have been written, namely Collapse_works and Reduction_collapse_works. Both of these are passing.

Additional work

This PR also creates the benchmarks/ subfolder, which will be the home for benchmarking DotMP. For a performance-oriented library, I am utterly ashamed at the lack of benchmarking that has happened. I hope to use BenchmarkDotNet to power benchmarks, but it is still a WIP.

I have also changed the access modifier of Lock._lock from internal to private. With the new API, there is no reason for _lock to be internal.

@codecov
Copy link

codecov bot commented Oct 11, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (26c0fb1) 90.06% compared to head (2d604ef) 93.28%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #86      +/-   ##
==========================================
+ Coverage   90.06%   93.28%   +3.22%     
==========================================
  Files          11       12       +1     
  Lines         805     1102     +297     
  Branches       86      101      +15     
==========================================
+ Hits          725     1028     +303     
+ Misses         58       54       -4     
+ Partials       22       20       -2     
Files Coverage Δ
DotMP/Iter.cs 100.00% <100.00%> (ø)
DotMP/Lock.cs 100.00% <ø> (ø)
DotMP/Parallel.cs 86.94% <100.00%> (+5.52%) ⬆️
DotMP/Wrappers.cs 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@computablee computablee marked this pull request as ready for review October 11, 2023 06:38
@computablee computablee merged commit f2f3154 into main Oct 11, 2023
12 checks passed
@computablee computablee added the hacktoberfest-accepted This PR was accepted as a Hacktoberfest PR label Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest-accepted This PR was accepted as a Hacktoberfest PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Parallel.ForCollapse and Parallel.ForReductionCollapse
1 participant